import { Component, OnInit } from '@angular/core';
import {Hero} from "../../class/hero";
import {HeroService} from "../../service/hero.service.service";

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.css'],
  providers:[HeroService]
})
export class DashboardComponent implements OnInit {
  heroes:Hero[]=[];
  constructor(private heroService:HeroService) { }

  ngOnInit() {
    this.heroService.getHeros().then(heros=>{
      this.heroes = heros.slice(0,4);
    });
  }

}
